package com.yishun.springboot.service;

import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.test.context.junit4.SpringRunner;

import com.yishun.springboot.mapper.GwsPushDataMapper;
import com.yishun.springboot.pojo.GwsPushData;

import lombok.extern.slf4j.Slf4j;

/**
 * 上传工务署实名制-考勤
 *
 * @author XiaoHuang
 * @date 2021年5月11日上午9:23:00
 */

@Slf4j
@Service
@Component
//@SpringBootTest
//@RunWith(SpringRunner.class)
public class GongWuSuTimedUploadCWSPersonnelPassageDataService {

	@Autowired
	GongWuSuUploadCWSService gongWuSuUploadCWSService;

	@Autowired
	GwsPushDataMapper gwsPushDataMapper;

//	// 定时上传考勤
	 @Async(value = "asyncExecutor")
	 @Scheduled(fixedRate = 2 * 60 * 60 * 1000)
//	 @Test
//	 @Scheduled(fixedDelay = 1000 * 60 * 60)
	public void uploadPersonnelPassageData() {
//		List<GwsPushData> gpdList = gwsPushDataMapper.selectAllRecord();
//		GwsPushData gpd = null;
//
//		String gwsProjectCode = null;
//		Integer yzwProjectCode = null;
//		String projectName = null;
		gongWuSuUploadCWSService.uploadPersonnelPassageData2(false,"HG003254", 354364, "深圳书城湾区城");// 上传考勤
//		for (int i = 0; i < gpdList.size(); i++) {
//			gpd = gpdList.get(i);
//			gwsProjectCode = gpd.getGwsProjectCode();
//			yzwProjectCode = gpd.getYzwProjectCode();
//			projectName = gpd.getProjectName();
//			gongWuSuUploadCWSService.uploadPersonnelPassageData2(false, gwsProjectCode, yzwProjectCode, projectName);// 上传考勤
//		}
	}
//
	@Async(value = "asyncExecutor")
	@Scheduled(fixedRate = 2 * 60 * 60 * 1000)
//	@Test
	public void uploadPersonnelPassageDataQY() {
//        List<GwsPushData> gpdList = gwsPushDataMapper.selectAllRecord();
//        GwsPushData gpd = null;
//
//        String gwsProjectCode = null;
//        Integer yzwProjectCode = null;
//        String projectName = null;
		gongWuSuUploadCWSService.uploadPersonnelPassageData2(false, "HG001267", 353633, "中山七院");// 上传考勤
	}
	//
    @Async(value = "asyncExecutor")
    @Scheduled(fixedRate = 2 * 60 * 60 * 1000)
	public void uploadPersonnelPassageDataKG() {
		//List<GwsPushData> gpdList = gwsPushDataMapper.selectAllRecord();
//        GwsPushData gpd = null;
//
//        String gwsProjectCode = null;
//        Integer yzwProjectCode = null;
//        String projectName = null;
		gongWuSuUploadCWSService.uploadPersonnelPassageData2(false, "HG003383", 356432, "深圳理工大学建设工程项目");// 上传考勤
	}


	@Async(value = "asyncExecutor")
	@Scheduled(fixedRate = 2 * 60 * 60 * 1000)
//	@Test
	public void uploadPersonnelPassageDataHY() {
//        List<GwsPushData> gpdList = gwsPushDataMapper.selectAllRecord();
//        GwsPushData gpd = null;
//
//        String gwsProjectCode = null;
//        Integer yzwProjectCode = null;
//        String projectName = null;
		gongWuSuUploadCWSService.uploadPersonnelPassageData2(false, "HG003844", 368071, "海洋大学（一期）建设项目施工总承包Ⅰ标段");// 上传考勤
	}
}
